package io.hepu.robotize.base;

import io.hepu.robotize.page.PageRequest;
import io.hepu.robotize.page.PageResponse;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface IBaseService<T, ID extends Serializable> {

    default ID findLastId(String table) {
        return null;
    }

    default Integer saveOne(T entity) {
        return 0;
    }

    default Integer deleteOne(ID id) {
        return 0;
    }

    default Integer deleteOne(T entity) {
        return 0;
    }

    default Integer updateOne(T entity) {
        return 0;
    }

    default T findOne(ID id) {
        return null;
    }

    default T findOne(T entity) {
        return null;
    }

    default void delete(ID[] ids) {
    }

    default void insert(Collection<T> entities) {
    }

    default void update(Collection<T> entities) {
    }

    default void delete(Collection<T> entities) {
    }

    default List<T> list(Map<String, Object> conditions) {
        return null;
    }

    default PageResponse<T> paginate(PageRequest request) {
        return null;
    }

    default Integer saveOrUpdate(T entity) {
        return 0;
    }

    default <S extends IBaseService<T, ID>> Integer saveOrUpdate(S service, T entity) {
        return 0;
    }
}
